package insight.miescor.opp.domain;

import com.google.gson.annotations.SerializedName;
import com.primavera.integration.client.bo.BusinessObjectException;
import com.primavera.integration.client.bo.object.Currency;

public class ICurrency {
	public static final String[] Fields = { "Id", "IsBaseCurrency",
			"ExchangeRate" };
	private String id;
	private String text;
	@SerializedName("selected")
	private boolean isBase;
	private double excRate;

	public ICurrency(Currency currency) throws BusinessObjectException {
		id = currency.getId();
		text = id;
		setBase(currency.getIsBaseCurrency());
		excRate = currency.getExchangeRate();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public boolean isBase() {
		return isBase;
	}

	public void setBase(boolean isBase) {
		this.isBase = isBase;
	}

	public double getExcRate() {
		return excRate;
	}

	public void setExcRate(double excRate) {
		this.excRate = excRate;
	}

	public double convert(double value) {
		return value * excRate;
	}
}
